vim9script noclear

if exists('g:globalvim')
	finish
endif
g:globalvim = 1

import autoload '../autoload/global.vim'

augroup global_vim
	autocmd!
	autocmd! BufWritePost *.c,*.h call global.GtagsAutoUpdate()
	autocmd! VimEnter *.c,*.h call global.GtagsCscope()
augroup END

#command! -nargs=0 GtagsCscope global.GtagsCscope()

nmap <silent> <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <silent> <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <silent> <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <silent> <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <silent> <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <silent> <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <silent> <C-\>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
nmap <silent> <C-\>a :cs find a <C-R>=expand("<cword>")<CR><CR>
